/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2024 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "crc.h"
#include "dma.h"
#include "tim.h"
#include "usart.h"
#include "gpio.h"
#include "stm32f1xx_it.h"

#include "ModBusToPrivateBus.h"
#include "PrivateBusMaster.h"
/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
typedef enum{
    LED_SATE_OFF = 0,
    LED_SATE_ON = 1,
}LED_SATE_ENUM;
/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define LED_BUS_Pin GPIO_PIN_13
#define LED_BUS_GPIO_Port GPIOC
#define LED_MCU_Pin GPIO_PIN_14
#define LED_MCU_GPIO_Port GPIOC

/* USER CODE BEGIN Private defines */
#define LED_BUS_SET(_STATE_) do{(_STATE_==LED_SATE_ON)?(LED_BUS_GPIO_Port->BRR=LED_BUS_Pin):(LED_BUS_GPIO_Port->BSRR=LED_BUS_Pin);}while(0)
#define LED_BUS_GET ((LED_BUS_GPIO_Port->ODR&LED_BUS_Pin)?LED_SATE_OFF:LED_SATE_ON)
#define LED_MCU_SET(_STATE_) do{(_STATE_==LED_SATE_ON)?(LED_MCU_GPIO_Port->BRR=LED_MCU_Pin):(LED_MCU_GPIO_Port->BSRR=LED_MCU_Pin);}while(0)
#define LED_MCU_GET ((LED_MCU_GPIO_Port->ODR&LED_MCU_Pin)?LED_SATE_OFF:LED_SATE_ON)
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
